# 29嵌套结构使用
# answer = input('请问你喝酒了吗？')
# if answer == 'y':
#     proof = eval(input('请输入酒精含量：'))
#     if proof < 20:
#         print('不构成酒驾，祝您一路平安')
#     elif proof < 80:
#         print('已构成酒家')
#     else:
#         print('已经达到了醉驾的标准，请千万不要开车')
# else:
#     print('未喝酒')

# 30 选择结构
# user_name = input('请输入用户名:')
# pwd = input("请输入密码：")
# if user_name == 'wxj' and pwd == '88888':
#     print("zhanghaozhengque")

# score = eval(input('请输入您的成绩：'))
# if score < 0 or score > 100:
#     print('成绩无效')
# else:
#     print('您的成绩为：', score)

# 31 模式匹配
# score = input("请输入你的成绩等级：")
# match score:
#     case 'A':
#         print('成绩为优秀')
#     case 'B':
#         print('成绩为良好')
#     case 'C':
#         print('成绩为合格')
#     case 'D':
#         print('成绩为不合格')

# 32 循环结构
# for i in 'hello':
#     print(i)
# for i in range(1, 11):
#     # print(i)
#     if i % 2 == 0:
#         print(i, '是偶数')


# 38 while循环
# i = 0
# while i < 100:
#     print("wenxiaojian")
#     i += 1

# 39 1-100求和
# sum = 0
# i = 1
# while i <= 100:
#     sum += i
#     i += 1
# print(f"1-100的和为：", sum)

# 40 while循环猜数字
# import random
#
# num = random.randint(1, 100)
# count = 0
#
# flag = True
# while flag:
#     guess_num = int(input("请输入你猜测数字："))
#     count += 1
#     if guess_num == num:
#         print("你猜中了")
#         flag = False
#     else:
#         if guess_num < num:
#             print("你猜小了")
#         else:
#             print('你猜大了')
# print(f"总共猜了{count}次")

# 41 while循环嵌套使用
# i = 1
# while i <= 100:
#     print(f"今天是第{i}天，准备表白")
#     i += 1
#     j = 1
#     while j < 10:
#         print(f"送给她第{j}只玫瑰")
#         j += 1
#     print("我喜欢你")
#     # i += 1
# print(f"坚持到第{i - 1}天，表白成功")

# 42 while循环案例
# i = 1
# while i <= 9:
#     j = 1
#     while j <= i:
#         print(f"{j}*{i}={i * j}\t", end='')
#         j += 1
#     i += 1
#     print()

# 43 for循环基础语法
# name = 'itheima is a brand of itcast'
# count = 0
# for i in name:
#     if i == 'a':
#         count += 1
# print(f"itheima is a brand of itcast中共有{count}个a")
#
# # 44 案例
# name = 'itheima is a brand of itcast'
# count = 0
# for i in name:
#     if i == 'a':
#         count += 1
# print(f"itheima is a brand of itcast中共有{count}个a")

# 45 range语句
# count = 0
# for num in range(1, 100):
#     if num % 2 == 0:
#         count += 1
# print(f'1-100之间一共{count}个偶数')

# 46 for循环临时变量
# i = 0
# for i in range(5):
#     print(i)
# print(i)

# 47 for循环嵌套
# i = 1
# for i in range(1, 101):
#     print(f"今天是表白的第{i}天，加油坚持")
#     for j in range(1, 11):
#         print(f"送出去的第{j}朵玫瑰花")
# print(f"第{i}天，终于表白成功了")
